//
//  MCMacro.h
//  meets-ios
//
//  Created by Mark on 15/10/23.
//  Copyright © 2015年 meets. All rights reserved.
//
#define NetSecurityService  MCKW

#define WeakSelf(weakSelf)  __weak __typeof(&*self) weakSelf = self;

#define MCAppDelegate  (MeetsAppDelegate *)[[UIApplication sharedApplication] delegate]

#define iOSVersion [[[UIDevice currentDevice] systemVersion] floatValue]

#define RGB(r, g, b) [UIColor colorWithRed: (r)/255.f green: (g)/255.f blue: (b)/255.f alpha: 1.f]

#define RGBA(r, g, b, a) [UIColor colorWithRed: r/255.0 green: g/255.0 blue: b/255.0 alpha: a]

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed: ((float)((rgbValue & 0xFF0000) >> 16))/255.0 green: ((float)((rgbValue & 0xFF00) >> 8))/255.0 blue: ((float)(rgbValue & 0xFF))/255.0 alpha: 1.0]

#define UIColorFromRGBA(rgbValue, a) [UIColor colorWithRed: ((float)((rgbValue & 0xFF0000) >> 16))/255.0 green: ((float)((rgbValue & 0xFF00) >> 8))/255.0 blue: ((float)(rgbValue & 0xFF))/255.0 alpha: a]

#define MeetOrange [UIColor colorWithRed:242.f/255.f green:125.f/255.f blue:39.f/255.f alpha:1.0]
#define MicoOrangeAlpha(a) [UIColor colorWithRed:242.f/255.f green:125.f/255.f blue:39.f/255.f alpha:a]

#define MeetGray UIColorFromRGB(0xf1f0ef)

#define MeetBlue [UIColor colorWithRed:0.0f/255.0f green:100.0f/255.0f blue:160.0f/255.0f alpha:1.0f]

#define NameColor UIColorFromRGB(0x000000)

#define TipColor UIColorFromRGB(0xfe9061)

#define WarnColor UIColorFromRGB(0xeb6a55)

#define VIPColor UIColorFromRGB(0xff4e00)

#define UserHeadTextColor UIColorFromRGB(0xffffff)

#define PlaceHolderGray UIColorFromRGB(0xc0c0c0)

#define TitleFont   [UIFont systemFontOfSize:18]
#define TitleColor  [UIColor colorWithWhite:0.18 alpha:1.0]


#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
#define SCREEN_WIDTH  [[UIScreen mainScreen] bounds].size.width
#define TABBAR_HEIGHT    49.f

//#define STATUSBAR_HEIGHT        ([UIApplication sharedApplication].statusBarFrame.size.height)
#define STATUSBAR_HEIGHT        20
#define NAVIGATIONBAR_HEIGHT    44

#define NAVI_HEADER_HEIGHT (CGRectGetMaxY(self.navigationController.navigationBar.frame))

#define CHATTING_FOOTER_TOOLBAR_HEIGHT  45.0f
#define CHATTING_FOOTER_PANNEL_HEIGHT   216.0f

#define ADAPTER_WIDTH_BASED6(v)     floor((v) / 375.f * [UIScreen mainScreen].bounds.size.width)
#define ADAPTER_HEIGHT_BASED6(v)    floor((v) / 667.f * [UIScreen mainScreen].bounds.size.height)

#define IMAGE_WIDTH(imageName)          [UIImage imageNamed:imageName].size.width
#define IMAGE_HEIGHT(imageName)          [UIImage imageNamed:imageName].size.height

#define STORE_OBJ_FOR_SHAREKEY(key, obj) ([[LevelDbManager sharedLevelDbManager].shareLdb setObject:obj forKey:key])
#define GET_OBJ_FOR_SHAREKEY(key)        ([[LevelDbManager sharedLevelDbManager].shareLdb objectForKey:key])
#define REMOVE_OBJ_FOR_SHAREKEY(key)     ([[LevelDbManager sharedLevelDbManager].shareLdb removeObjectForKey:key])

// system version
#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
#define iOS7_0 @"7.0"

#define MICO_MOBILE_CODE_KEY        @"mobilecode"
